package com.xuanyuan.model;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * UserinfoId entity. @author MyEclipse Persistence Tools
 */
@Embeddable
public class UserinfoId implements java.io.Serializable {

	// Fields

	private String userName;
	private String phoneNumber;

	// Constructors

	/** default constructor */
	public UserinfoId() {
	}

	/** full constructor */
	public UserinfoId(String userName, String phoneNumber) {
		this.userName = userName;
		this.phoneNumber = phoneNumber;
	}

	// Property accessors

	@Column(name = "userName", length = 10)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "phoneNumber", length = 15)
	public String getPhoneNumber() {
		return this.phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof UserinfoId))
			return false;
		UserinfoId castOther = (UserinfoId) other;

		return ((this.getUserName() == castOther.getUserName()) || (this
				.getUserName() != null
				&& castOther.getUserName() != null && this.getUserName()
				.equals(castOther.getUserName())))
				&& ((this.getPhoneNumber() == castOther.getPhoneNumber()) || (this
						.getPhoneNumber() != null
						&& castOther.getPhoneNumber() != null && this
						.getPhoneNumber().equals(castOther.getPhoneNumber())));
	}

	public int hashCode() {
		int result = 17;

		result = 37 * result
				+ (getUserName() == null ? 0 : this.getUserName().hashCode());
		result = 37
				* result
				+ (getPhoneNumber() == null ? 0 : this.getPhoneNumber()
						.hashCode());
		return result;
	}

}